import axios from "../config.js";
/**
 * 分页查询人员信息
 * @returns {Promise<unknown>}
 */
export const findPage = data => {
    return axios({
        url: "/demo/person/findByPage",
        method: "get",
        params: data
    });
};

/**
 * 查询所有人员信息
 * @returns {Promise<unknown>}
 */
export const findAll = data => {
    return axios({
        url: "/demo/person/findAll",
        method: "post",
        params: data
    });
};

/**
 * 通过id查找单个数据信息
 * @returns {Promise<unknown>}
 */
export const findOne = (data) => {
    return axios({
        url: "/demo/person/findOne/" ,
        method: "post",
        data
    });
};

export const findByName = (data) => {
    return axios({
        url: "/demo/person/findByName/" ,
        method: "post",
        data
    });
};

export const findByPhone = (data) => {
    return axios({
        url: "/demo/person/findByPhone/" ,
        method: "post",
        data
    });
};



/**
 * 通过上传表格进行添加人员信息
 * @param data
 * @returns {Promise<unknown>}
 */
export const saveFromExcel = data => {
    return axios({
        url: "/demo/person/saveFromExcel",
        method: "post",
        data
    });
};
/**
 * 添加人员信息
 * @param data
 * @returns {Promise | Promise<unknown>}
 */
export const save = data => {
    return axios({
        url: "/demo/person/save/" ,
        method: "post",
        data
    });
};
/**
 * 更新人员信息
 * @param data
 * @returns {Promise | Promise<unknown>}
 */
export const update = data => {
    return axios({
        url: "/demo/person/update/" ,
        method: "post",
        data
    });
};
/**
 * 删除人员信息
 * @param data
 * @returns {Promise | Promise<unknown>}
 */
export const del = (data) => {
    return axios({
        url: "/demo/person/delete/" ,
        method: "post",
        data
    });
};

/**
 * 删除选中人员信息
 * @param data
 * @returns {Promise | Promise<unknown>}
 */
export const delMgs = data => {
    return axios({
        url: "/demo/person/deleteMessages" ,
        method: "post",
        data
    });
};
